

#include <rtthread.h>
#include "sram1_heap.h"

#if defined(RT_USING_MEMHEAP)

struct rt_memheap sram1_heap;

void *sram1_malloc(unsigned long size)
{
    return rt_memheap_alloc(&sram1_heap,size);
}

void sram1_free(void *ptr)
{
    rt_memheap_free(ptr);
}

void *sram1_calloc(unsigned int n,unsigned int size)
{
    void* ptr = NULL;

    ptr = sram1_malloc(n * size);
    if(ptr)
    {
        rt_memset(ptr, 0, n*size);
    }

    return ptr;
}

void *sram1_realloc(void *mem_address, unsigned int newsize)
{
    return rt_memheap_realloc(&sram1_heap, mem_address, newsize);
}

#endif
